package service

import (
	"context"
	"os"

	"git.huoys.com/middle-end/kratos/pkg/conf/paladin"
	pb "gitee.com/rzttw/grpc/api"
	"github.com/google/wire"
)

var Provider = wire.NewSet(New, wire.Bind(new(pb.DemoServer), new(*Service)))

// Service service.
type Service struct {
	ac  *paladin.Map

}

// New new a service and return.
func New() (s *Service, cf func(), err error) {
	s = &Service{
		ac:  &paladin.TOML{},
	}
	cf = s.Close
	return
}

// SayHello grpc demo func.
func (s *Service) SayHello(ctx context.Context, req *pb.HelloReq) (resp *pb.HelloResp, err error) {
	resp = &pb.HelloResp{}
	hostname, err := os.Hostname()
	if err != nil {
		return nil, err
	}
	resp.Content = hostname
	return
}


// Close close the resource.
func (s *Service) Close() {
}
